1. How the browser's rendering engine works:(1) Parse HTML, generate DOM tree. Parsing an HTML document, converting HTML tags in a tree or JS-generated tags to a DOM node, which is called the content tree.(2) Build a rendering tree, parse style, generate style Rules, parse CSS (including external CSS files and style elements, and JS-generated styles), calculate the style of the node according to the CSS selector, create another tree-the rendering tree.(3) according to (1) and (2) Start the layou
1. What is repaint/reflow?
During the page loading process, the document structure needs to be parsed, and various styles need to be combined to calculate the page length, and then render the page through the browser. This entireThe process is still complex in detail, which is full of repaint and reflow. Each element in the DOM structure has its own box (model ).
stored with the corresponding CSS property.4, once the render tree is created, the browser can draw the page directly to the screen based on the render tree.An example of a rendering processFor example, there is an HTML code like this: Once upon a time there wasA looong paragraph ...Secret message...Then the DOM tree is exactly the same as the HTML tag one by one, as follows:DocumentElement (HTML)HeadTitleBodyP[Text node]Div[Text node]DivImg ...The r
Reduce the reflow and repaint and reflowrepaint of the browser
1. Avoid frequent DOM operations on the document directly. If necessary, use the off-document method. The specific methods include but do not fully include the following: (1) first Delete the element from the document, and then put the element back to its original position after modification.(2) set the display of the element to "none". After t
be left-to-right, top-to-bottom.All HTML reflow starts with the root frame (the HTML tag) and recursively handles some or all of the child frames. It is also possible to create a new frame during reflow, such as text that has a newline. The backflow of a frame causes all its parent nodes and all subsequent elements to reflow.Some HTML reflow is performed immedia
1. What is Reflow?Reflow (reflow) refers to the process by which a browser recalculates the position and geometry of elements in a document in order to re-render some or all of the documents.Because reflux can cause the entire DOM tree to be reconstructed, it is a major killer of performance.The following operations ca
Before the discussion page redraws, reflow. Need to have some understanding of the page rendering process, the page is how to display HTML, CSS, etc. to the browser, the following flowchart shows the browser to the page rendering process. Different browsers may be slightly different. But basically, they are similar.High-performance Web development-page rendering,
In order to re-render parts or entire pages, the process of recalculating page element position and geometry (geometries) is called reflow. Because Reflow is a user intercept (user-blocking) operation in a browser, learn how to reduce the number of reflow, and different document properties (DOM level (DOM depth), CSS e
In order to re-render parts or entire pages, the process of recalculating page element position and geometry (geometries) is called reflow.Because Reflow is a user intercept (user-blocking) operation in a browser, learn how to reduce the number of reflow, and different document properties (DOM level (DOM depth), CSS efficiency, no type of style change), the numbe
Before the discussion redraw, reflow. Need to have some understanding of the rendering process, how to put HTML in conjunction with CSS and other explicit to the browser, the nextThe flowchart shows the process of rendering the browser pair. Different browsers may be slightly different. But basically, they are similar.1. The
that Visibility:hidden hidden elements are still included in the render tree, because Visibility:hidden affects the layout and occupies space. According to the CSS2 standard, each node in the render tree is called box dimensions, which understands that the page element is a box with padding, margins, borders, and positions.4. Once the render tree is built, the browser can draw the page based on the render tree. Such as:Reflow and Redraw1. When part (
Dom programming can be the most time-consuming place to rearrange and redraw.1. What is reflow and redrawAfter the browser has downloaded all the components in the page--html tags, JavaScript, CSS, and images will parse the resulting two internal data structures--dom tree and render tree.The DOM tree represents the page structure, and the render tree represents how the DOM nodes are displayed. Each node in
This article mainly introduces the usage of Repaint and Reflow in JavaScript, which is the basic knowledge in JS beginners, if you want to use a CSS wildcard *, do you often hear from senior colleagues or some front-end predecessors? CSS selector layers cannot exceed three layers. CSS class selector should be used whenever possible, writing HTML uses less tables, and the structure should be as simple as possible-the DOM tree should be small .... with
Do you often listen to senior or some front-end predecessors said that can not use CSS wildcard *,CSS selector cascade can not be more than three layers, CSS as far as possible using class selector, writing HTML less use table, the structure should be as simple as possible-dom tree small .... And so on, I've probably known that using wildcards or too many CSS selectors may degrade performance, so why not use the table label I have been in a daze, and then do so, but I know Repain and
hidden elements are still included in the render tree, because Visibility:hidden affects the layout and occupies space. According to the CSS2 standard, each node in the render tree is called box dimensions, which understands that the page element is a box with padding, margins, borders, and positions.
4. Once the render tree is built, the browser can draw the page based on the render tree. second, reflow a
elements are still included in the render tree, because Visibility:hidden affects the layout and occupies space. According to the CSS2 standard, each node in the render tree is called box dimensions, which understands that the page element is a box with padding, margins, borders, and positions.4. Once the render tree is built, the browser can draw the page based on the render tree.Second, reflow and redraw
1. repaintrepainting occurs when the appearance of an element is changed but the layout is not changed, such as changing visibility, outline, and foreground. When repaint occurs, the browser verifies the visibility attribute of all other nodes on the DOM tree. 2. If a Reflow change involves an element layout (such as width), the browser discards the original attr
Article Introduction: page refactoring should pay attention to repaint and reflow.
Recently learned about the next repaint and reflow related knowledge, feel that in the page refactoring process should consider front-end development (JS) staff to operate the DOM, can reduce the customer browser pear.Here to tidy up a bit of relevant information, recomm
included in the render tree because Visibility:hidden affects the layout (layout) and occupies space. According to CSS2 's standard, each node in the render tree is called box dimensions, which understands that the page element is a box with padding, margins, borders, and positions.4. Once the render tree is constructed, the browser can draw the page based on the render tree.Second, reflow and redraw1. Som
certain part of the change has affected the layout and needs to be reflow back, which insiders call the retreat process.
Reflow is almost inevitable. Now some of the popular effects on the interface, such as the collapse of the tree directory, expansion (essentially the display and hidden elements), and so on, will cause the browser's reflow. Mouse slide over
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.